<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Microsoft Environment Setter Add-in</title>
	<style type="text/css"> 
	BODY { FONT-SIZE: 8pt; FONT-FAMILY: Verdana; font-face: Verdana }
	H1 { FONT-SIZE: 14pt }
	H2 { FONT-SIZE: 12pt }
	H3 { FONT-SIZE: 10pt }
	LI { LINE-HEIGHT: 12pt }
	TABLE { FONT-SIZE: 100%; WIDTH: 93%; BORDER-COLLAPSE: collapse }
	TH { BORDER-RIGHT: #999999 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #999999 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bolder; PADDING-BOTTOM: 5px; BORDER-LEFT: #999999 1px solid; COLOR: #000000; PADDING-TOP: 5px; BORDER-BOTTOM: #999999 1px solid; BACKGROUND-COLOR: #eeeeee; TEXT-ALIGN: left }
	TD { BORDER-RIGHT: #999999 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #999999 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #999999 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #999999 1px solid }
	P.code { FONT-SIZE: 8pt; MARGIN-LEFT: 5%; COLOR: blue; MARGIN-RIGHT: 5%; FONT-FAMILY: 'Courier New'; font-face: Courier }
	</style>
</head>
<body>
	<h1>Environment Setter</h1>
	<p>
		September 2006</p>
	<h2>
		What it Does</h2>
	<p>
		This is a simple add-in for Visual Studio 2005 that can be used to set environment
		variables in the DevEnv.exe process.&nbsp; The add-in does the following:</p>
	<ul>
		<li>When you open a solution it looks for an XML file called <strong>&lt;SolutionName&gt;.environ</strong>.&nbsp;
			If it finds the file it uses it to set environment variables in the DevEnv.exe process.&nbsp;
			These variables will be used by Visual Studio and by any processes spawned by Visual
			Studio.&nbsp; </li>
		<li>Environment variables that are set are reported to the <strong>Output </strong>tool
			window in the <strong>General </strong>pane.</li>
	</ul>
	<p>
		You should already be aware that Visual Studio C/C++/NMake projects can further
		modify the spawned processes environments, and that those changes may conflict with
		yours.&nbsp;
	</p>
	<h2>
		How to Install It</h2>
	<p>
		There's no setup program for the add-in, because one of the things that I wrote
		the add-in for was to add the <a href="http://wix.sourceforge.net">WiX</a> tools
		to the environment so that I could build setups.</p>
	<p>
		To set up the add-in simply:</p>
	<ol>
		<li>Copy the files to <strong>%ProgramFiles%\Microsoft Environment Setter Add-in\</strong></li>
		<li><span style="font-family: Courier New"></span>In Visual Studio go to <strong>Tools -&gt; Options -&gt; Add-in/Macro Security</strong>
		</li>
		<li>In the list box for <strong>Add-in File Paths </strong>add <strong>%ProgramFiles%\Microsoft
			Environment Setter Add-in\</strong></li><li>Close and re-open Visual Studio.</li>
		<li>Go to <strong>Tools -&gt; Add-in Manager... </strong>and check the the add-in is
			visible.</li>
		<li>Copy the file <strong>Environments-v1.1.xsd</strong> to <strong>%ProgramFiles%\Microsoft
			Visual Studio 8\Xml\Schemas\</strong> in order to get automatic Intellisense when
			you open and edit a <strong>.environ </strong>file.</li>
	</ol>
	<h2>
		Environment File Format</h2>
	<p>
		A typical environment file might look like this:
	</p>
	<p>
		<img alt="Example.environ" src="EnvironFile.png" />&nbsp;</p>
	<p>
		This sample is included in the disribution.&nbsp;
	</p>
	<p>
		The <strong>&lt;Environment&gt; </strong>tag is the
			element that defines an environment for your solution.&nbsp; This needs to have
			a <strong>Name <span style="font-family: Courier New"></span> </strong>attribute that matches the
			solution file name exactly.&nbsp; The <strong>&lt;Set&gt; </strong>elements should be self explanitory.&nbsp; You
		can define <strong>&lt;Property&gt; </strong>elements before any of the <strong>&lt;Environment&gt;</strong>
		elements, and substitute them in the appropriate <strong>Value </strong>attribute
		using <strong>$(PropertyName) </strong>in the attribute text.&nbsp; This is similar
		the way properties work in, say, MSBuild.</p>
	<p>
		Any existing environment variables can also be substituted by using <strong>$(env.PATH)</strong>.
		&nbsp; <em>Note that everything is case sensitive</em>.&nbsp; Be careful of that.&nbsp;
		Do a <strong>SET </strong>on the command line to see what the correct case is.</p>
	<p>
		<em>Copyright &copy; Microsoft Corporation.  All rights reserved. </em>
	</p>

</body>
</html>
